﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1.0, user-scalable=no">
    <title>修改密码</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href='css/style.css' type="text/css">
</head>
<style>
    body {
        background-color: #660099
    }

    a:visited {
        color: gray;
    }
</style>

<script type="text/javascript" src="js/WdatePicker.js"></script>
<script type='text/javascript' src='js/prototype.js'></script>
<script type='text/javascript' src='js/sha1.js'></script>
<script type='text/javascript' src='js/public.js'></script>
<script type="text/javascript">
    function test() {
        var userPwd = hex_sha1(document.getElementById("userPwd").value);
        var userp = document.getElementById("userPwd").value;
        var newPwd = document.getElementById("newPwd").value;
        var newPwd1 = document.getElementById("newPwd1").value;
        var newp = hex_sha1(newPwd);
        if (userp == "" || newPwd == "" || newPwd1 == "") {
            alert("请将信息输入完整");
        }

        else if (newPwd == newPwd1) {
            var params = "newPwd=" + newp + "&oldPwd=" + userPwd;

            new Ajax.Request("json/altUser_Pwd", {
                method: "post",
                parameters: params,
                onComplete: function (request) {

                    var res = request.responseText.evalJSON();

                    if (res["result"]["flag"] == "true") {
                        alert("密码已成功修改，如遗忘可通过管理老师修改");

                    } else
                        alert("失败，请确认学号没有被注册");
                },
                asynchronous: true
            });
        } else {
            alert("两次输入密码不一致，请重新确认");
        }

    }
</script>
<body onload="">
<div class="container">
    <div class="row">
        <div class="col-xs-12" style="text-align:center;color:white;font-size:18px;border-bottom:4px solid #660033">
            经管院学术讲坛事务系统
        </div>
    </div>
    <div class="row">
        <!--div class="col-lg-2 col-md-2 col-sm-2 col-xs-1"></div-->
        <div class="col-lg-4 col-md-4 col-sm-4 col-xs-6" id="username" style="color:white;float:left;">&nbsp;你好</div>
        <div class="col-lg-5 col-md-5 col-sm-5 col-xs-6">
            <a onclick="outline()" style="text-decoration: none;float:right;" href="#">注销</a>

        </div>
    </div>

    <div id="main" class="container">
        <div style="width: 100%; font-size:20px;">
            <div style="margin-top: 10px; margin-left: 0px; height: 440px">
                <div style="margin-top: 80px;float: left; border: 2px solid #CCC; height: 200px; width: 100%;">
                    <form method="post" style="font-size: 18px">
                        <font color="white">旧密码:</font><br> <input type="password" id="userPwd" name="userPwd"
                                                                   size="22" style="height: 20px"><br> <font
                            color="white">新密码:</font><br> <input
                            type="password" id="newPwd" name="newPwd" size="22"
                            style="height: 20px"><br> <font color="white">确认密码:</font><br> <input
                            type="password" id="newPwd1" name="newPw1" size="22"
                            style="height: 20px"><br> <br> <input
                            type="button" value="修改" onclick="test()"
                            style="border:1px solid; border-color:#CCC; height: 28px; width: 70px; font-size: 22px;">
                    </form>
                </div>
            </div>

        </div>
    </div>

</body>
</html>